package com.bw.liuyushan.zhuangao4_mvptest1.Adapter;

import android.view.View;

import com.bw.liuyushan.zhuangao4_mvptest1.Entity.ViedoBean;
import com.bw.liuyushan.zhuangao4_mvptest1.R;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.shuyu.gsyvideoplayer.video.StandardGSYVideoPlayer;

import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.util.List;

/**
 * ZhuanGao4_MVPTest1
 * file name is : ViedoPageAdapter
 * created by Ender on 2021/8/18 16:14.
 * author : Liuyushan
 * Describe(作用):视频显示的适配器
 */
public class ViedoPageAdapter extends BaseQuickAdapter<ViedoBean.DataBean, BaseViewHolder> {
    private int i = 1;
    public ViedoPageAdapter(@Nullable List<ViedoBean.DataBean> data) {
        super(R.layout.itemviedopage, data);
    }

    @Override
    protected void convert(@NotNull BaseViewHolder baseViewHolder, ViedoBean.DataBean dataBean) {
        StandardGSYVideoPlayer standardGSYVideoPlayer = baseViewHolder.findView(R.id.Stand_VideoPage);
        standardGSYVideoPlayer.setUp(dataBean.getVideopath(),false,dataBean.getAuthname());
        if (i==1){
            standardGSYVideoPlayer.startPlayLogic();
            i++;
        }
        //实现点击全屏
        standardGSYVideoPlayer.getFullscreenButton().setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                standardGSYVideoPlayer.startWindowFullscreen(getContext(),true,true);
            }
        });

    }
}
